package com.ycj.lockcache.lock;

import com.ycj.lockcache.enums.LockType;
import org.redisson.api.RLock;

/**
 *
 * @author changjin.yuan
 * @Date 2019/9/2 14:40
 */
public interface DistributedLock {

    /**
     *
     * @param lockKey
     * @param timeout
     * @return
     */
    RLock lock(String lockKey, long timeout);

    /**
     *
     * @param lockKey
     * @param lockType
     * @param timeout
     * @return
     */
    RLock lock(String lockKey, LockType lockType, long timeout);

    /**
     * unlock
     * @param lockKey
     */
    void unlock(String lockKey);

    /**
     * unlock
     * @param lock
     */
    void unlock(RLock lock);

}
